package edu.berkeley.cs160.innovationers.shoppersidekick;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class AddMember extends Activity implements OnClickListener{

	EditText memberName;
	
	@Override
	public void onClick(View v) {
		switch(v.getId()) {
		case (R.id.newMemberCancelButton):
			setResult(1,null);
			finish();
			break;
		case (R.id.newMemberOKButton):
			Intent resultIntent=new Intent();
			resultIntent.putExtra("CONTENT", memberName.getText().toString());
			setResult(100,resultIntent);
			finish();
			break;
		}
	}
	
	public void onCreate(Bundle savedInstanceState) {
        
    	super.onCreate(savedInstanceState);
        
        setContentView(R.layout.addmember);  
        getWindow().setLayout(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        memberName = (EditText)findViewById(R.id.newMemberName);
        Button myCancelButton=(Button)findViewById(R.id.newMemberCancelButton);
        Button myOKButton=(Button)findViewById(R.id.newMemberOKButton);
        
        myCancelButton.setOnClickListener(this);
        myOKButton.setOnClickListener(this);

    }


}
